﻿using System.ComponentModel.DataAnnotations;

namespace SwaggerDemo.Models;

/// <summary>
/// 用户账号
/// </summary>
public class LoginModel
{
    /// <summary>
    /// 用户登录模型
    /// </summary>
    [Required(ErrorMessage = "账号不能为空！")]
    [StringLength(10, ErrorMessage = "账号长度不能超过10个字符")]
    public string UserName { get; set; }
    
    /// <summary>
    /// 密码
    /// </summary>
    [Required]
    [StringLength(20,MinimumLength=6, ErrorMessage = "账号长度不能超过10个字符")]
    public string Password { get; set; }
}

/// <summary>
/// 用户注册模型
/// </summary>
public class RegisterModel
{
    /// <summary>
    /// 用户名
    /// </summary>
    [Required(ErrorMessage = "用户名是必填项")] 
    public string UserName { get; set; }

    /// <summary>
    /// 密码
    /// </summary>
    [Required(ErrorMessage = "密码是必填项")]
    [MinLength(6, ErrorMessage = "密码长度不能少于6个字符")]
    public string Password { get; set; }

    /// <summary>
    /// 邮箱
    /// </summary>
    [Required(ErrorMessage = "电子邮件是必填项")]
    [EmailAddress(ErrorMessage = "请输入有效的电子邮件地址")]
    public string Email { get; set; }
}


/// <summary>
/// 用户信息
/// </summary>
public class UserInfo
{
    /// <summary>
    /// 编号
    /// </summary>
    public int Id { get; set; }

    /// <summary>
    /// 用户名
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 年龄
    /// </summary>
    [Range(8, 100)]
    public int Age { get; set; }

    /// <summary>
    /// 手机
    /// </summary>
    [Phone(ErrorMessage = "手机格式错误！")]
    public string Phone { get; set; }

    /// <summary>
    /// 地址
    /// </summary>
    public string Address { get; set; }

    /// <summary>
    /// 是否已婚
    /// </summary>
    public bool Married { get; set; }

    /// <summary>
    /// 邮箱
    /// </summary>
    [EmailAddress(ErrorMessage = "邮箱格式错误")]
    public string Email { get; set; }

    /// <summary>
    /// 角色
    /// </summary>
    public string[] Role { get; set; }
}